<template>

      <el-col :span="24" class="colmargin">
        <el-card class="box-card" style="width:100%;margin:auto; margin-bottom:10px;
        ;font-size: 14px; overflow: auto;" v-for="(item,index) in currentPageData"
        :key="index">
       
  <el-col :span="24" >
      操作类型:
    <span class="span" >
      {{item.target_type==1?'入院登记':item.target_type==2?'分床':
      item.target_type==3?'申请出院':item.target_type==4?'提交出院':
      item.target_type==5?'召回':item.target_type==6?'转科':item.target_type==7?
      '出院成功':item.target_type==8?'变更床位':item.target_type==9?'变更护理等级':
      item.target_type==10?'设置饮食种类':item.target_type==11?'撤销出院':
      item.target_type==12?'撤销申请出院':item.target_type==13?'撤销出院':''
      }}
        </span>
         </el-col>
          <el-col :span="24" >
      操作员:
    <span class="span" >
      {{item.get_create_user.real_name}}
        </span>
         </el-col>
          <el-col :span="24">
             操作内容:
            <span class="span">
      {{item.remark}}
        </span>
         </el-col>
          <el-col :span="24">
            操作时间:
       <span class="span" >
      {{item.updated_at}}
        </span>
         </el-col>
        
       
</el-card>
     <el-pagination
  background
  small
  layout="prev, pager, next"
  :current-page='currentPage'
  :page-size='pageSize'
  :total="totalPage"
  @prev-click='prevPage'
    @next-click='nextPage'
    v-if="currentPageData.length!=0"
  >
</el-pagination>
<el-dialog :close-on-click-modal='false'
  title="提示"
  :visible.sync="centerDialogVisible"
  width="70%"
  center
  class="see_box"
  v-if="tableData.lenght!=0"
  >

  <span slot="footer" class="dialog-footer">
  
    <el-button type="success" @click="centerDialogVisible = false">确 定</el-button>
  </span>
</el-dialog>
<el-empty description="暂无数据"  v-if="currentPageData.length==0"></el-empty>
      </el-col>

</template>

<script>
import {
  getHospitalizationChangeRecord,
} from "@/api/zhuyanre";

export default {
  // name:"costsRecord",
    props: ["id"],
  data(){
    return {
      tableData:[
     
      ],
      centerDialogVisible:false,
      item:{},
 //所有数据
              totalPage: 1, // 统共页数，默认为1
             currentPage: 1, //当前页数 ，默认为1
            pageSize: 5, // 每页显示数量
            currentPageData: [] //当前页显示内容
    
    }
    
  },
   mounted(){
       
      this.getExecutionList()

   },
     watch:{
      id(){
         this.getExecutionList()
         this.totalPage = this.totalPage == 0 ? 1 : this.totalPage;
      }
   },
   methods:{
     //查看  详情
     seedelit(item){
       console.log(item)
       this.item=item
       this.centerDialogVisible=true
     },
        getExecutionList() {
     let d = {
        hospital_id:this.id,
      };

      getHospitalizationChangeRecord(d).then((res) => {
         if(res.code==200){
           this.tableData=res.data.lists
           this.item=this.tableData[0]
           this.totalPage=res.data.lists.length 
           this.totalPage = this.totalPage == 0 ? 1 : this.totalPage;
           let begin = (this.currentPage - 1) * this.pageSize;
                let end = this.currentPage * this.pageSize;
                this.currentPageData = this.tableData.slice(
                begin,
                end
                );
         }
      });
    },
        setCurrentPageData() {
                  let begin = (this.currentPage - 1) * this.pageSize;
                let end = this.currentPage * this.pageSize;
                this.currentPageData = this.tableData.slice(
                begin,
                end
                );
        },
//上一页
prevPage() {
        console.log(this.currentPage);
        if (this.currentPage == 1) return;

        this.currentPage--;
        this.setCurrentPageData();

},
// 下一页
nextPage() {
        if (this.currentPage == this.totalPage)return ;

        this.currentPage++;
        this.setCurrentPageData();

        }
 }

 
 
}
</script>

<style scoped>
.colmargin{
  overflow: auto ;
    padding: 0 10px;
} 
.see_box .el-col{
  margin:5px 0px;
  font-size: 20px;
}
.see_box .span{
  color: dimgray;
  font-size: 18px;
  text-indent:2em;
}
 .span{
  color: dimgray;
  font-size: 13px;
  text-indent:2em;
}
.colmargin .el-col{
  margin:2px 0px;
}
</style>